-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: [FN-60] 회원 탈퇴 #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
""" Walkthrough사용자 탈퇴(비활성화) 기능이 추가되었습니다. User 엔터티와 서비스, 컨트롤러, 저장소에 관련 메서드가 도입되었고, 소프트 딜리트 필드명이 변경되었습니다. 테스트 코드에는 사용자 탈퇴 케이스가 추가되고, 기존 사용자 생성 방식이 fixture로 개선되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant UserController
participant UserService
participant UserRepository
participant User
Client->>UserController: DELETE /v1/users (with 인증)
UserController->>UserService: unregister(userId)
UserService->>UserRepository: findByIdAndStatus(userId, ACTIVE)
UserRepository-->>UserService: Optional<User>
alt User exists
UserService->>User: softDelete()
UserService-->>UserController: void
UserController-->>Client: 204 No Content
else User not found
UserService-->>UserController: BizException(USER_NOT_FOUND)
UserController-->>Client: Error Response
end
Poem
""" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/main/java/project/flipnote/common/entity/SoftDeletableEntity.java(1 hunks)src/main/java/project/flipnote/user/controller/UserController.java(2 hunks)src/main/java/project/flipnote/user/entity/User.java(1 hunks)src/main/java/project/flipnote/user/repository/UserRepository.java(1 hunks)src/main/java/project/flipnote/user/service/UserService.java(2 hunks)src/test/java/project/flipnote/user/service/UserServiceTest.java(5 hunks)
🔇 Additional comments (14)
src/main/java/project/flipnote/user/entity/User.java (1)
79-83: 소프트 딜리트 구현이 올바르게 작성되었습니다.부모 클래스의
softDelete()메서드를 호출한 후 사용자 상태를INACTIVE로 설정하는 이중 보호 방식이 잘 구현되어 있습니다. 이는 데이터 일관성과 비즈니스 로직 측면에서 모범적인 접근 방식입니다.src/main/java/project/flipnote/user/repository/UserRepository.java (1)
18-18: 리포지토리 메서드가 올바르게 추가되었습니다.Spring Data JPA 명명 규칙을 준수하고
Optional반환 타입으로 null-safety를 보장하는 좋은 구현입니다.src/main/java/project/flipnote/common/entity/SoftDeletableEntity.java (3)
12-12: 필드명 변경이 적절합니다.
deletedDate에서deletedAt으로의 변경은 시간 정보를 포함한 더 정확한 의미를 나타내며, 일반적인 명명 규칙을 따릅니다.
15-15: 메서드 내 참조가 올바르게 업데이트되었습니다.필드명 변경에 따른 일관된 업데이트가 적용되었습니다.
19-19: 조건 검사 메서드가 올바르게 업데이트되었습니다.변경된 필드명이 적절히 반영되어 있습니다.
src/main/java/project/flipnote/user/controller/UserController.java (3)
5-6: 필요한 import가 올바르게 추가되었습니다.
@AuthenticationPrincipal과@DeleteMapping사용을 위한 import가 적절히 추가되었습니다.
14-14: 인증 관련 DTO import가 올바릅니다.
UserAuthDTO를 통한 인증 정보 처리가 적절합니다.
32-36: 회원 탈퇴 엔드포인트가 올바르게 구현되었습니다.REST API 관례를 준수하고, 인증된 사용자 정보를 통해 보안을 보장하며, 적절한 HTTP 상태 코드를 반환하는 좋은 구현입니다.
src/main/java/project/flipnote/user/service/UserService.java (4)
13-13: 필요한 import가 올바르게 추가되었습니다.
UserStatusenum 사용을 위한 import가 적절히 추가되었습니다.
54-59: 회원 탈퇴 메서드가 올바르게 구현되었습니다.
@Transactional어노테이션으로 트랜잭션 무결성을 보장하고, 활성 사용자 검증 후 소프트 딜리트를 수행하는 적절한 구현입니다.
61-64: 헬퍼 메서드가 잘 설계되었습니다.활성 상태의 사용자만 조회하고 적절한 예외 처리를 하는 재사용 가능한 헬퍼 메서드입니다. 코드의 가독성과 유지보수성을 향상시킵니다.
54-64: 연관 엔터티 미발견 – 추가 처리 불필요합니다
현재 코드베이스 내에서 JPA 어노테이션(@OnetoOne, @manytoone, @onetomany 등)을 통해 User 엔터티를 참조하는 다른 도메인 엔터티가 존재하지 않습니다. 사용자 소프트 딜리트만으로도 무방하며, 별도의 연관 데이터 처리 로직은 필요하지 않습니다.src/test/java/project/flipnote/user/service/UserServiceTest.java (2)
7-7: 새로운 import문 추가 승인테스트 기능 확장을 위한 적절한 import문들이 추가되었습니다.
Optional,UserFixture,UserStatus는 모두 새로운 탈퇴 테스트와 fixture 사용에 필요한 요소들입니다.Also applies to: 23-23, 25-25
54-54: fixture 사용으로 테스트 코드 개선수동으로 사용자 인스턴스를 생성하던 방식을
UserFixture.createActiveUser()로 변경한 것은 좋은 개선입니다. 테스트 데이터 생성의 일관성과 유지보수성이 향상됩니다.Also applies to: 75-75
📝 변경 내용
✅ 체크리스트
💬 기타 참고 사항
Summary by CodeRabbit
신규 기능
버그 수정
리팩터
deletedDate→deletedAt)으로 일관성이 향상되었습니다.테스트